package 模拟真题;

import java.util.Scanner;

/**
 * @author ShadowLim
 * @create 2022-03-24-17:42
 */
public class A的个数 {
    static int n = 25;
    static char[][] a = new char[n][n];
    static int ans = 0;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        for (int i = 0; i < a.length; i++) {
            String str = scanner.next();
            for (int j = 0; j < a.length; j++) {
                a[i][j] = str.charAt(j);
                if (a[i][j] == 'A') {
                    ans++;
                }
            }
        }
        System.out.println(ans);
    }
}
